package com.zxmr.webclient.domain.service;

import java.sql.SQLException;
import java.util.List;

import com.zxmr.db.DBManager;
import com.zxmr.webclient.ComponentInit;
import com.zxmr.webclient.domain.SupportFileFormat;

public class SupportFileFormatService {

	DBManager db = ComponentInit.getDBManager();
	
	public boolean addFileFormat(SupportFileFormat ff)
	{
		try
		{
			db.getMapper().insert("fileformat.add", ff);
			return true;
		}catch(SQLException e)
		{
			e.printStackTrace();
		}
		return false;
	}
	public boolean deleteFileFormat(int id)
	{
		try
		{
			db.getMapper().delete("fileformat.delete", id);
			return true;
		}catch(SQLException e)
		{
			e.printStackTrace();
		}
		return false;
	}
	@SuppressWarnings("unchecked")
	public List<String> queryByType(String type)
	{
		try
		{
			return (List<String>)db.getMapper().queryForList("fileformat.findByType", type);
		}catch(SQLException e)
		{
			e.printStackTrace();
		}
		return null;
	}
	@SuppressWarnings("unchecked")
	public List<String> queryAllType()
	{
		try
		{
			return (List<String>)db.getMapper().queryForList("fileformat.findAllType");
		}catch(SQLException e)
		{
			e.printStackTrace();
		}
		return null;
	}
}
